home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8709 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.bridge.net!news
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Trying to do weird function overloading
  5. Date: 26 Feb 1996 04:20:19 GMT
  6. Organization: self-employed
  7. Message-ID: <4grce3$h5j@news.bridge.net>
  8. References: <4gqvaf$msv@mother.usf.edu>
  9. NNTP-Posting-Host: ppp-mia1-40.bridge.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15.  
  16. >>        friend Color scale(Color c1, double f);
  17. >>        friend Color scale(double f, Color c2);
  18. >>        Color scale(double f) { return scale(*this, f); }
  19.  
  20.  
  21. >> In the member function, I'm trying to call the friend function, but 
  22. >> the compiler is thinking that I'm trying to call the member function.
  23.  
  24.  
  25.    I don't see why. You are passing a Color and a double..the member 
  26. function does not take 2 parameters, so how can it get called? 
  27.  
  28.  
  29. >> so how would I scope resolve outward?
  30.  
  31.  
  32.    Specify the appropriate namespace or global scope;
  33.  
  34.  
  35.          ::scale(*this, f) ;        // function in global scope 
  36.  
  37.  
  38.  
  39.                              David
  40.  
  41.  
  42.